test: remove useless global setup file#82
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the project's test infrastructure by eliminating an unnecessary global test setup file and its corresponding dependencies. This change reduces the project's footprint, simplifies the test configuration, and ensures that only actively used packages are maintained. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully removes an unnecessary global setup file and its associated dependency, tcp-port-used. The logic for logging the version has been correctly relocated to rstest.config.ts, and the method for determining the webpack version for snapshots has been fixed. I have one suggestion to make the version extraction more robust for the future.
rstest.config.ts
Outdated
|
|
||
| const [webpackVersion] = rspackVersion; | ||
| const snapshotExtension = `.snap.webpack${webpackVersion}`; | ||
| const snapshotExtension = `.snap.webpack${webpackVersion[0]}`; |
There was a problem hiding this comment.
Using webpackVersion[0] to get the major version number is a bit fragile. This will not work correctly if the webpack major version reaches 10 or higher (it would extract '1' instead of '10'). A more robust approach would be to split the version string by . and take the first part.
| const snapshotExtension = `.snap.webpack${webpackVersion[0]}`; | |
| const snapshotExtension = `.snap.webpack${webpackVersion.split('.')[0]}`; |
There was a problem hiding this comment.
Pull request overview
This PR removes an unused global test setup helper and cleans up related test configuration and dependencies.
Changes:
- Deleted
tests/helpers/global-setup-test.jsand removed it fromglobalSetupinrstest.config.ts. - Moved the “running tests for …” version logging into
rstest.config.tsand changed how the webpack version is sourced for snapshot naming. - Removed the unused
tcp-port-useddev dependency and pruned it from the lockfile.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/helpers/global-setup-test.js | Deletes an unused global setup script. |
| rstest.config.ts | Removes globalSetup, adds version logging, and adjusts snapshot extension version logic. |
| package.json | Drops tcp-port-used from devDependencies. |
| pnpm-lock.yaml | Removes tcp-port-used and its transitive deps from the lockfile. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
rstest.config.ts:7
- This log message says "rspack" but prints
webpackVersion. That’s misleading when debugging test runs; either log the rspack version here or adjust the label to match the value being printed.
console.log(`Running tests for rspack @${webpackVersion} \n`);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
remove useless global setup file.